#pragma once

#define  IMAGETYPES  7
#define  NIBBLES     6656
#define  TRACK_DENIBBLIZED_SIZE  4096

static  UINT    g_uNumTracksInImage = 0;

struct Disk_t
{
    char  *image;
    int   disksize;
    BOOL diskindrive;
    int    track;
    LPBYTE trackimage;
    int    phase;
    int    byte;
    BOOL   writeprotected;
    BOOL   trackimagedata;
    BOOL   trackimagedirty;
    DWORD  spinning;
    DWORD  writelight;
    int    nibbles;
    TCHAR      filename[MAX_PATH];
    DWORD      format;
    DWORD      offset;
    LPBYTE     header;
    BOOL       validtrack[TRACKS_MAX];
    UINT       uNumTracks;
};

BOOL    ImageBoot (Disk_t *);
void    ImageClose (Disk_t *);
void    ImageInitialize ();

enum ImageError_e
{
	IMAGE_ERROR_BAD_POINTER    =-1,
	IMAGE_ERROR_NONE           = 0,
	IMAGE_ERROR_UNABLE_TO_OPEN = 1,
	IMAGE_ERROR_BAD_SIZE       = 2
};

int ImageOpen (char *, Disk_t *);

void    ImageReadTrack (Disk_t *, int *);
void    ImageWriteTrack (Disk_t *);



int ImageGetNumTracks(Disk_t *);
